home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / forms / formsx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-23  |  1.4 KB  |  90 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "forms.h"
  4. #include "formsx.h"
  5.  
  6. static char buf[FLX_INPUTLEN];
  7.  
  8. void flx_set_input_printf(FL_OBJECT *obj, char *format, ...) {
  9.   va_list a_list;
  10.  
  11.   va_start(a_list, format);
  12.   vsprintf(buf, format, a_list);
  13.   fl_set_input(obj, buf);
  14.  
  15. }
  16.  
  17. void flx_set_input_float(FL_OBJECT *obj, float f) {
  18.   
  19.   sprintf(buf, "%.2f", f);
  20.   fl_set_input(obj, buf);
  21.  
  22. }
  23.  
  24. void flx_set_input_int(FL_OBJECT *obj, int i) {
  25.   
  26.   sprintf(buf, "%d", i);
  27.   fl_set_input(obj, buf);
  28.  
  29. }
  30.  
  31. /*
  32. void flx_get_input_scanf(FL_OBJECT *obj, char *format, ...) {
  33.   va_list a_list;
  34.  
  35.   va_start(a_list, format);
  36.   ----------------- This routine does not seem to exist --------
  37.   vsscanf(fl_get_input(obj), format, a_list);
  38.  
  39. }
  40. */
  41.  
  42. float flx_get_input_float(FL_OBJECT *obj) {
  43.   float f;
  44.  
  45.   sscanf(fl_get_input(obj), "%f", &f);
  46.   return f;
  47.  
  48. }
  49.  
  50. int flx_get_input_int(FL_OBJECT *obj) {
  51.   int i;
  52.  
  53.   sscanf(fl_get_input(obj), "%d", &i);
  54.   return i;
  55.  
  56. }
  57.  
  58. void flx_enable(FL_OBJECT *obj, int lcol) {
  59.   
  60.   obj->active = 1;
  61.   if (lcol == -1) lcol = 0;
  62.   if (lcol != -2) fl_set_object_lcol(obj, lcol);
  63.  
  64. }
  65.  
  66. void flx_disable(FL_OBJECT *obj, int lcol) {
  67.  
  68.   obj->active = 0;
  69.   if (lcol == -1) lcol = 17;
  70.   if (lcol != -2) fl_set_object_lcol(obj, lcol);
  71.  
  72. }
  73.  
  74.  
  75. FL_OBJECT *flx_findobject(FL_FORM *form, char *label) {
  76.   FL_OBJECT *obj;
  77.   obj = form->first;
  78.   while (1) { 
  79.     if (!strcmp(label, obj->label)) return(obj);
  80.     if (obj == form->last) return NULL;
  81.     obj = obj->next;
  82.   }
  83. }
  84.  
  85.  
  86.  
  87.  
  88.   
  89.  
  90.